const a = async function (
  _,
  { $grid, row },
  { memory },
  { dc: { open }, xe: { get } }
) {
  const ret = await new Promise((resolve) => {
    const transfer = row;
    const layout = { id: "1785946370247495682" };
    const modal = {
      title: "编辑项目",
      width: "55vw",
      height: "55vh",
      defaultFullscreen: false,
      destroyOnClose: false,
      maskClosable: false,
      open: true,
      showOkBtn: false,
      showCancelBtn: true,
      centered: true,
      afterClose: function () {
        const ret = get(memory, "modal", false);
        delete memory.modal;
        resolve(ret);
      },
    };
    const inner = {};
    open({ inner, layout, modal, transfer });
  });
  console.log("modal ret: ", ret);
  if (!ret) return;
  $grid.commitProxy("query");
};

const b = async function (
  { me, memory, transfer },
  { $grid, dayjs, dc, xe: { clone, set } }
) {
  const { http, next, store, update } = dc;
  const { isReadonly, GUID } = transfer;
  const year = dayjs(store.get("user", "date")).format("YYYY");
  const { list: value } = await http.form({
    url: "/zw/czItem/listItemSub",
    data: { ITEMGUID: GUID, YEAR: year, CTYPE: 2 },
  });
  set(memory, me, clone(value, true));
  if (!isReadonly && !value.length) value.push({});
  const openEdit = { editConfig: { enabled: !isReadonly } };
  await update({ path: me, action: "attr", value: openEdit });
  await update({ path: me, action: "load", value: value });
  await next();
  $grid[isReadonly ? "hideColumn" : "showColumn"]($grid.getColumnById("oper"));
};
